//token
const jwt = require('jsonwebtoken');
const secret = 'lm6464';
//生成token
exports.generateToken = function(e) {
    let payload = { username: e, time: new Date() };
    let token = jwt.sign(payload, secret, { expiresIn: 60 * 60 * 24 * 120 });
    return token;
};
//解码token
exports.verifyToken = function(e) {
    let payload = jwt.verify(e, secret)
    console.log(payload)
    return payload;
}